#include <scene.h>
#include <button.h>
#include <scene_manager.h>
#include <iostream>
#include <list_selecter.h>
#include <win32_utils.h>

class SceneLoading : public Scene{
private:
    SceneManager& sceneManager;
    std::unordered_map<std::string, Texture2D>& texture_blocks;
    Font* font;

    Texture2D texture_loading = LoadTexture("assets\\textures\\loding.png");
    std::vector<Rectangle> frames;
    int frame=0;
    float timeout=0;
public:
    SceneLoading(SceneManager& manager, std::unordered_map<std::string, Texture2D>& texture_blocks, Font* font) :sceneManager(manager),texture_blocks(texture_blocks),font(font) {

        for(int j=0; j<3; j++)
            for(int i=0; i<4; i++)
                frames.push_back({(float)i*6,(float)j*6,6,6});
    };
    ~SceneLoading() {}

    void init(){
        
    }

    void render(float dt) override {
        timeout += dt;
        if(timeout > 0.1)
        {
            frame++;
            timeout = 0;
        }
        frame = (frame)%12;
        DrawTexturePro(texture_loading, frames[frame], {(float)GetScreenWidth()/2-50,(float)GetScreenHeight()/2-50,100,100}, {0,0}, 0, BLACK);
        
    }
};